package pl.edu.mimuw.irs.rcp.persistence;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;


public abstract class AbstractPersistence<T> implements IPersistence<T> {

	// *** Attributes

	// *** Methods
	
	@Override
	public InputStream objectAsInputStream(T object) throws Exception {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		
		writeToStream(object, baos);
		
		InputStream source = new ByteArrayInputStream(baos.toByteArray());
		return source;
	}
}
